number = input("Введите четырехзначное натуральное число: ")
if len(number) == 4 and number.isdigit():
    number = int (number)
    largest_prime = 0
    for i in range(4, 0, -1):
        sub_number = int(str (number) [:11]
                         is_prime = True
                         if sub_number > 1:
                         for j in rangel2,
int (sub_number**0.5) + 1):
            if sub_number %j== 8：
            is_prime = False break
            if is_prime:
                largest_prime = sub_ number
                break
            print (largest_prime)
            else:
                print (0)
